package com.xingyi.bacs.controller;

import com.xingyi.bacs.bean.DLRAccountInfo;
import com.xingyi.bacs.bean.User;
import com.xingyi.bacs.service.UserService;
import com.xingyi.bacs.vo.ResponeBodyVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by wujt on 23/9/2021
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/getUser")
    public ResponeBodyVo getUserVO(String id) {
        ResponeBodyVo responeBodyVo = new ResponeBodyVo();
        User user = userService.findMerchantById(id);
        responeBodyVo.setData(user);
        responeBodyVo.setErrorCode(ResponeBodyVo.SUCCESS);
        responeBodyVo.setErrorMsg("连接成功");
        return responeBodyVo;
    }

    @RequestMapping("/getFruser")
    public ResponeBodyVo getMerchant(String id){
        ResponeBodyVo responeBodyVo = new ResponeBodyVo();
        List<DLRAccountInfo> user = userService.findFruser(id);
        responeBodyVo.setData(user);
        responeBodyVo.setErrorCode(ResponeBodyVo.SUCCESS);
        return responeBodyVo;
    }
}
